package TwentyOne.Array;

class ArrayReverse {

    public static void reverse(int data[]) {
        int center = data.length / 2;  //确定转换的次数
        int head = 0;  //操作的脚标
        int tail = data.length - 1;  //操作脚标
        for (int x = 0; x < center; x++) {
            int temp = data[head];
            data[head] = data[tail];
            data[tail] = temp;
            head++;
            tail--;
        }
    }

    public static void printArray(int temp[]) {
        for (int x = 0; x < temp.length; x++) {
            System.out.print(temp[x] + "、");
        }
        System.out.println();
    }
}

public class a9_ArrayReverse {

    public static void main(String[] args) {
        int data[] = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
        ArrayReverse.reverse(data);
        ArrayReverse.printArray(data);
    }
}
